﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NetworkPower
{
    public partial class MainForm : Form
    {

        private Dictionary<string, string> dicTwo = new Dictionary<string, string>();
        public MainForm()
        {
            InitializeComponent();
        }

        private void cmbProject_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                for (int i = 0; i < cmbProject.Items.Count; i++)
                {
                    if (cmbProject.Items[i].ToString() == cmbProject.Text)
                    {
                        //MessageBox.Show("already exists");
                    }
                }
                cmbProject.Items.Add(cmbProject.Text);
            }
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            
        }

        private void btnAddV_Click(object sender, EventArgs e)
        {
            if (txtV.Text.Length != 0)
            {
                lbV.Items.Add(txtV.Text);
            }
        }

        private void btnAddS_Click(object sender, EventArgs e)
        {
            if (txtS.Text.Length != 0)
            {
                lbS.Items.Add(txtS.Text);
            }
        }

        private void btnAddTwo_Click(object sender, EventArgs e)
        {
            if (txtUnit.Text.Length != 0 & txtSName.Text.Length != 0)
            {
                List<KeyValuePair<string, string>> d = new List<KeyValuePair<string, string>>();
                d.Add(new KeyValuePair<string, string>(txtSName.Text, txtUnit.Text));
                dgvTwo.DataSource = d;
            }
            else
            {
                MessageBox.Show("请补全安装单位和间隔名称");
            }
        }


    }
}
